package ans.p171;

import test.Entrance;

/**
 * #      171
 * 名称   Excel表列序号
 * 链接   https://leetcode-cn.com/problems/excel-sheet-column-number
 * 题解   [485](https://leetcode-cn.com/problems/excel-sheet-column-number/solution)
 * 通过率 69.0%
 * 难道   简单
 */

public class Solution {
    @Entrance
    public int titleToNumber(String columnTitle) {
        int num = 0;
        for (int i = 0; i < columnTitle.length(); i++) {
            num = num * 26 + (columnTitle.charAt(i) - 'A' + 1);
        }
        return num;
    }
}